<template>
	<view :style="[{paddingTop:CustomBar+'px'}]">
		<cu-custom bgColor="bg-ticket-center" :isBack="true">
			<block slot="backText"></block>
			<block slot="content">收银记录</block>
		</cu-custom>
		<view class="list">
			<view class="use-item" v-if="date1!='请选择时间'">
				<view class="text">门店销售金额</view>
				<view class="price">￥{{officeSalesAmount?officeSalesAmount:0}}</view>
			</view>
			<view class="compont">
				<view>
					<view class="title">资金明细</view>
					<view class="info">
						<picker mode="date" :value="date1" start="2018-01-01" end="2999-12-31" @change="bindDateChange1">
							<view class="picker" style='color: rgba(106, 161, 222, 1)'>
								{{date1}}
							</view>
						</picker>
						<text class="lg text-gray" :class="'cuIcon-right'"></text>
					</view>
				</view>
			</view>

			<view class="item" v-for="(item,index) in offList" :key="index">
				<view></view>
				<view>
					<text>{{item.add_time}}</text>
					<text>¥ {{item.order_amount}}</text>
				</view>
			</view>

			<view class="no-content" v-if="offList.length==0">
				<image src="http://xarkbucket.oss-cn-hangzhou.aliyuncs.com/no-order.png"></image>
				<text>暂无门店订单</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				CustomBar: this.CustomBar,
				offPage: 1,
				offList: [],
				date1: '请选择时间',
				officeSalesAmount: ''
			}
		},
		onLoad() {
			 this.onOffOrder()
		},
		methods: {
			bindDateChange1(e) {
				var that = this;
				that.date1 = e.detail.value
				this.$request({
					url: '/Shop/todaySalesByUser',
					data: {
						day: e.detail.value
					},
					success: res => {
						if (res.data.status == 1) {
							var offList = res.data.data.data
							that.offList = offList
							that.offPage = 1
							that.officeSalesAmount = res.data.data.salesAmount
							uni.hideLoading()
						}
					},
					fail: () => {},
					complete: () => {}
				});
			},
			onOffOrder() {
				var that = this;
				this.$request({
					url: '/Order/getDistributionOrderByUid',
					data: {
						page: that.offPage
					},
					success: res => {
						if (res.data.status == 1) {
							var offList = that.offList
							if (res.data.data.data.length > 0) {
								res.data.data.data.forEach(item => {
									offList.push(item)
								})
							}
							that.offPageCount = res.data.data.pageCount
							that.offList = offList
							that.offPage++
							uni.hideLoading()
						}
					},
					fail: () => {},
					complete: () => {}
				});
			},
		},
		onReachBottom() {
			if (this.date1 != '请选择时间') return ;
			if (this.offPage>this.offPageCount){
				uni.showToast({
					title:'没有更多了',
					icon:'none'
				})
				return 
			}
			this.onOffOrder();
		}
	}
</script>

<style>
	page{
		background: #fff;
	}
</style>
<style scoped>
	page {
		background: #fff;
	}

	.tab-truth {
		width: 710rpx;
		height: 60rpx;
		border-radius: 8rpx;
		display: flex;
		margin: 20rpx auto;
		box-sizing: border-box;
		border: solid 1rpx #f2f2f2;
	}

	.tab-truth>view {
		flex: 1;
		text-align: center;
		line-height: 55rpx;
	}

	.tab-truth>view:nth-child(1) {
		border-radius: 8rpx 0 0 8rpx;
		border-right: solid 1rpx #f2f2f2;
	}

	.tab-truth>view:nth-child(2) {
		border-radius: 0 8rpx 8rpx 0;
	}

	.tab-truth .active {
		background: linear-gradient(to right, #19e8db, #3080e8);
		/* 标准的语法 */
		color: #fff;
	}

	.list {
		width: 100%;
		padding: 0 20rpx;
		box-sizing: border-box;
	}

	.item {
		width: 100%;
		padding: 20rpx 0;
		border-bottom: dashed 1rpx #f2f2f2;
	}

	.list .item:nth-child(1) {
		border-top: dashed 1rpx #f2f2f2;
	}

	.item>view:nth-child(1) {
		font-size: 30rpx;
		color: #333;
	}

	.item>view:nth-child(2) {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.item>view:nth-child(2) text:nth-child(1) {
		color: #999;
		font-size: 24rpx;
	}

	.item>view:nth-child(2) text:nth-child(2) {
		color: #e03d3d;
		font-size: 28rpx;
	}

	.no-content {
		width: 100%;
		padding-top: 63px;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		background: #fff;
	}

	.no-content image {
		width: 208rpx;
		height: 150rpx;
	}

	.no-content text {
		color: #999;
		margin-top: 20rpx;
	}


	.compont {
		width: 100%;
		height: 80rpx;
		/* padding: 0 20rpx; */
		box-sizing: border-box;
	}

	.compont>view {
		width: 100%;
		height: 80rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		box-sizing: border-box;
		border-bottom: solid 1rpx #f2f2f2;
	}

	.compont .title {
		color: rgba(24, 24, 24, 1);
		font-size: 14px;
	}

	.compont .info {
		color: rgba(243, 75, 75, 1);
		font-size: 14px;
		display: flex;
		width: 180rpx;
		align-items: center;
		justify-content: space-between;
	}

	.compont .info .right-icon {
		width: 20rpx;
		height: 30rpx;

	}

	.compont .info .right-icon {
		width: 20rpx;
		height: 30rpx;
	}

	.use-item {
		width: 100%;
		height: 80rpx;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		border-bottom: solid 1rpx #f2f2f2;
	}

	.use-item .icon {
		width: 60rpx;
		height: 60rpx;
		border-radius: 8rpx;
		background-color: rgba(46, 184, 114, 1);
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.use-item:nth-child(2) .icon {
		background-color: rgba(21, 173, 246, 1);
	}

	.use-item:nth-child(3) .icon {
		background-color: rgba(255, 191, 68, 1);
	}

	.use-item .icon image {
		width: 40rpx;
		height: 40rpx;
		color: #fff;
	}

	.use-item .text {
		flex: 1;
		/* padding-left: 20rpx; */
		box-sizing: border-box;
		line-height: 60rpx;
		color: rgba(90, 75, 65, 1);
		font-size: 28rpx;
	}

	.use-item .money {
		font-size: 28rpx;
		color: rgba(246, 96, 132, 1);
		width: 100rpx;
		text-align: center;
		line-height: 60rpx;
	}

	.use-item .right-icon {
		width: 22rpx;
		height: 36rpx;
		margin-top: 10rpx;
	}

	.use-item .price {
		color: rgba(243, 75, 75, 1);
		font-size: 28rpx;
	}
</style>
